params ["_box", "_levelSupply"];
private ["_weapon_num", "_parts", "_headgear", "_mine", "_launch"];


//-2
if(_levelSupply == -2) exitWith{_box setVariable["res_num", 10, true]};


_weapon_num = call fn_weaponNum;



//-1
if(_levelSupply == -1) then
{

	_parts = selectRandom (selectRandom asp_0);
	_headgear = selectRandom ash_0;
	
	[0, _box] call fn_initWeapon;
	
	_box addItemCargoGlobal [_parts, 1];
	
	_box addItemCargoGlobal [_headgear, 1];
	_box setVariable["res_num", 20, true]
};
//0
if(_levelSupply >= 0 && _levelSupply <= 3) then
{
	for "_i" from 1 to _weapon_num do
	{
		if(random 100 < (55 *Param_WeaponNum)) then
		{
			_parts = selectRandom (selectRandom asp_0);
			_headgear = selectRandom ash_0;
			
			
			[0, _box] call fn_initWeapon;
			
			_box addItemCargoGlobal [_parts, 1];
			
			_box addItemCargoGlobal [_headgear, 1];
					
			
		};

	};
	//反射器
	_launch = selectRandom asl_0;
	private _lName = _launch select 0;
	private _lNum = _launch select 1;
	private _lMag = (_launch select 0) call fn_getWeaponMag;
	
	_box addItemCargoGlobal [_lName, 1];
	for "_j" from 1 to _lNum do{
		_box addItemCargoGlobal [selectRandom _lMag, 1];
	};
	
	//榴弹
	_box addItemCargoGlobal ["1Rnd_HE_Grenade_shell", 1 + (count AllPlayers) / 6];
};

//1
if(_levelSupply >= 1 && _levelSupply <= 4) then
{
	for "_i" from 1 to _weapon_num do
	{
		if(random 100 < (50 *Param_WeaponNum)) then
		{
			_parts = selectRandom (selectRandom asp_1);
			_headgear = selectRandom ash_1;
			
			[1, _box] call fn_initWeapon;
			
			_box addItemCargoGlobal [_parts, 1];
			
			_box addItemCargoGlobal [_headgear, 1];
			
			//地雷
			_mine = selectRandom asp_mine;
			_box addItemCargoGlobal [_mine, 1];
			
			
		};

	};
	//反射器
	_launch = selectRandom asl_1;
	private _lName = _launch select 0;
	private _lNum = _launch select 1;
	private _lMag = (_launch select 0) call fn_getWeaponMag;
	
	_box addItemCargoGlobal [_lName, 1];
	for "_j" from 1 to _lNum do{
		_box addItemCargoGlobal [selectRandom _lMag, 1];
	};
	
	//榴弹
	_box addItemCargoGlobal ["1Rnd_HE_Grenade_shell", 1 + (count AllPlayers) / 5];
	
	//随机荧光弹
	//_box addItemCargoGlobal [selectRandom asp_chemlight, 1];
};

//2
if(_levelSupply >= 2 && _levelSupply <= 5) then
{
	for "_i" from 1 to _weapon_num do
	{
		if(random 100 < (45 *Param_WeaponNum)) then
		{
			_parts = selectRandom (selectRandom asp_2);
			_headgear = selectRandom ash_2;
			
			[2, _box] call fn_initWeapon;
			
			_box addItemCargoGlobal [_parts, 1];
			
			_box addItemCargoGlobal [_headgear, 1];
			
			//地雷
			_mine = selectRandom asp_mine;
			_box addItemCargoGlobal [_mine, 1];
		};

	};
	//反射器
	_launch = selectRandom (asl_1 + asl_2);
	private _lName = _launch select 0;
	private _lNum = _launch select 1;
	private _lMag = (_launch select 0) call fn_getWeaponMag;
	
	_box addItemCargoGlobal [_lName, 1];
	for "_j" from 1 to _lNum do{
		_box addItemCargoGlobal [selectRandom _lMag, 1];
	};
	
	//榴弹
	_box addItemCargoGlobal ["1Rnd_HE_Grenade_shell", 1 + (count AllPlayers) / 4];
	
	//.50BW
	_box addItemCargoGlobal ["10Rnd_50BW_Mag_F", 2 + (count AllPlayers) / 7];
	
	//随机荧光弹
	_box addItemCargoGlobal [selectRandom asp_chemlight, 1];
};

//3
if(_levelSupply >= 3 && _levelSupply <= 6) then
{
	for "_i" from 1 to _weapon_num do
	{
		if(random 100 < (40 *Param_WeaponNum)) then
		{
			_parts = selectRandom (selectRandom asp_3);
			_headgear = selectRandom ash_3;
			
			[3, _box] call fn_initWeapon;
			
			_box addItemCargoGlobal [_parts, 1];
			
			_box addItemCargoGlobal [_headgear, 1];
			
			
		};

	};
	//反射器
	_launch = selectRandom (asl_2 + asl_3);
	private _lName = _launch select 0;
	private _lNum = _launch select 1;
	private _lMag = (_launch select 0) call fn_getWeaponMag;
	
	_box addItemCargoGlobal [_lName, 1];
	for "_j" from 1 to _lNum do{
		_box addItemCargoGlobal [selectRandom _lMag, 1];
	};
	
	//榴弹
	_box addItemCargoGlobal ["3Rnd_HE_Grenade_shell", 1 + (count AllPlayers) / 6];
	
	//随机荧光弹
	_box addItemCargoGlobal [selectRandom asp_chemlight, 2];
};

//4
if(_levelSupply >= 4 && _levelSupply <= 7) then
{
	for "_i" from 1 to _weapon_num do
	{
		if(random 100 < (35 *Param_WeaponNum)) then
		{
			_parts = selectRandom (selectRandom asp_4);
			_headgear = selectRandom ash_4;
			
			[4, _box] call fn_initWeapon;
			
			_box addItemCargoGlobal [_parts, 1];
			
			_box addItemCargoGlobal [_headgear, 1];
			
			
		};

	};
	//反射器
	_launch = selectRandom asl_3;
	private _lName = _launch select 0;
	private _lNum = _launch select 1;
	private _lMag = (_launch select 0) call fn_getWeaponMag;
	
	_box addItemCargoGlobal [_lName, 1];
	for "_j" from 1 to _lNum do{
		_box addItemCargoGlobal [selectRandom _lMag, 1];
	};
	
	//榴弹
	_box addItemCargoGlobal ["3Rnd_HE_Grenade_shell", 1 + (count AllPlayers) / 5];
	
	//随机荧光弹
	_box addItemCargoGlobal [selectRandom asp_chemlight, 3];
	
	//无人机终端
	_box addItemCargoGlobal ["O_UavTerminal", 1];
};

//5代表更多武器 和4的代码一样
if(_levelSupply >= 5 && _levelSupply <= 8) then
{
	for "_i" from 1 to _weapon_num do
	{
		if(random 100 < (35 *Param_WeaponNum)) then
		{
			_parts = selectRandom (selectRandom asp_4);
			_headgear = selectRandom ash_4;
			
			[4, _box] call fn_initWeapon;
			
			_box addItemCargoGlobal [_parts, 1];
			
			_box addItemCargoGlobal [_headgear, 1];
			
			
		};

	};
	//反射器
	_launch = selectRandom asl_3;
	private _lName = _launch select 0;
	private _lNum = _launch select 1;
	private _lMag = (_launch select 0) call fn_getWeaponMag;
	
	_box addItemCargoGlobal [_lName, 1];
	for "_j" from 1 to _lNum do{
		_box addItemCargoGlobal [selectRandom _lMag, 1];
	};
	
	//榴弹
	_box addItemCargoGlobal ["3Rnd_HE_Grenade_shell", 1 + (count AllPlayers) / 5];
	
	//随机荧光弹
	_box addItemCargoGlobal [selectRandom asp_chemlight, 3];
};